/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Paul
 */
public class AssociationCours extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            this.doAny(request, response);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            this.doAny(request, response);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private void doAny(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        /**
         * DAO
         */
        //Récupérer les cours de l'enseignant connecté
        //Récupérer les étudiants des cours de l'enseignant
        //Vérification
        //Redirection vers la JSP
        HttpSession session = request.getSession(true);
        session.setAttribute("listeEtudiants", request);
        session.setAttribute("listeCours", request);
        request.getRequestDispatcher("/WEB-INF/view/administration/associationCours.jsp").forward(request, response);
    }
}
